package com.ruoyi.basic.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.domain.BasicAppoint;
import com.ruoyi.basic.domain.BasicImage;
import com.ruoyi.basic.mapper.BasicAppointMapper;
import com.ruoyi.basic.service.IBasicAppointService;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 员工任免表Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-12-07
 */
@Service
public class BasicAppointServiceImpl extends ServiceImpl<BasicAppointMapper, BasicAppoint> implements IBasicAppointService
{
    /**
     * 查询员工任免表
     * 
     * @param appointId 员工任免表主键
     * @return 员工任免表
     */
    @Override
    public BasicAppoint selectBasicAppointByAppointId(Long appointId)
    {
        return baseMapper.selectBasicAppointByAppointId(appointId);
    }

    /**
     * 查询员工任免表列表
     * 
     * @param basicAppoint 员工任免表
     * @return 员工任免表
     */
    @Override
    public List<BasicAppoint> selectBasicAppointList(BasicAppoint basicAppoint)
    {
        return baseMapper.selectBasicAppointList(basicAppoint);
    }

    /**
     * 查询员工任免表列表
     *
     * @param appointIds 责任任免表id
     * @return 员工图片
     */
    @Override
    public List<BasicAppoint> selectBasicAppointListByAppointIds(String appointIds)
    {
        LambdaQueryWrapper<BasicAppoint> queryWrapper = new LambdaQueryWrapper<BasicAppoint>();
        queryWrapper.in(BasicAppoint::getAppointId, Convert.toLongArray(appointIds));
        return baseMapper.selectList(queryWrapper);
    }

    /**
     * 新增员工任免表
     * 
     * @param basicAppoint 员工任免表
     * @return 结果
     */
    @Override
    public int insertBasicAppoint(BasicAppoint basicAppoint)
    {
        basicAppoint.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insert(basicAppoint);
    }

    /**
     * 修改员工任免表
     * 
     * @param basicAppoint 员工任免表
     * @return 结果
     */
    @Override
    public int updateBasicAppoint(BasicAppoint basicAppoint)
    {
        basicAppoint.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateById(basicAppoint);
    }

    /**
     * 批量删除员工任免表
     * 
     * @param appointIds 需要删除的员工任免表主键
     * @return 结果
     */
    @Override
    public int deleteBasicAppointByAppointIds(String appointIds)
    {
        return baseMapper.deleteBatchIds(Arrays.asList(Convert.toLongArray(appointIds)));
    }

    /**
     * 删除员工任免表信息
     * 
     * @param appointId 员工任免表主键
     * @return 结果
     */
    @Override
    public int deleteBasicAppointByAppointId(Long appointId)
    {
        return baseMapper.deleteById(appointId);
    }
}
